package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.dto.CourseBaseDTO;
import com.xuecheng.content.entity.CourseBase;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface CourseBaseConvert {

    CourseBaseConvert INSTANCE = Mappers.getMapper(CourseBaseConvert.class);

    //source为数据库字段，target是实体类字段
    @Mapping(source = "id",target = "courseBaseId")
    CourseBaseDTO entity2dto(CourseBase courseBase);

    List<CourseBaseDTO> entitys2dtos(List<CourseBase> courseBases);
}
